A good answer might be:

array     = new int[ size ];  

You do not not need to say how many elements the array has when you write the program. The user picks the size when the program runs. The array constructor creates the array after the user has specified how large the array is to be.


Minimum and Maximum

The largest integer in a list of integers is the maximum value. The maximum may occur several times, but no other integer in the list is larger. Look at the following:

2, 9, 52, 23, -19, 23, 17, -45, 0

The integer 52 is the maximum. If you plot these integers on a number line 52 is the last one on the right:

Similarly, the smallest integer in the list is the minimum. The minimum may occur several times. In the above list, the minimum is -45. On the number line, the minimum is the last one on the left.

QUESTION 7:

Examine the following collection of integers:

-20, 19, 1, 5, -1, 27, 19, 5
  1. What is the maximum of the collection?
  2. How did you figure this out?